using System;
using System.Activities;
using System.Activities.Statements;
using Headsight.BPMN2WF.Transformation;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Headsight.BPMN2WF
{
    [TestClass]
    public class BPMNTransformationResultTest
    {
        private Activity _result;
        private Object _flowIn;
        private Object _flowOut;
        private BPMNTransformationResult _sut;

        [TestInitialize]
        public void SetUp()
        {
            _result = new If();
            _flowIn = new Object();
            _flowOut = new Object();

            _sut = new BPMNTransformationResult(_result, _flowIn, _flowOut);
        }

        private BPMNTransformationResult CreateSut2(Activity result, Object flowIn)
        {
            return _sut = new BPMNTransformationResult(result, flowIn);
        }

        private BPMNTransformationResult CreateSut3(Activity result, Object flowIn, Object flowOut)
        {
            return _sut = new BPMNTransformationResult(result, flowIn, flowOut);
        }

        [TestMethod]
        public void Result()
        {
            Assert.AreSame(_result, CreateSut2(_result, _flowIn).Result);
            Assert.AreSame(_result, CreateSut3(_result, _flowIn, _flowOut).Result);
        }

        [TestMethod]
        public void FlowIn()
        {
            Assert.AreSame(_flowIn, CreateSut2(_result, _flowIn).FlowIn);
            Assert.AreSame(_flowIn, CreateSut3(_result, _flowIn, _flowOut).FlowIn);
        }

        [TestMethod]
        public void FlowOut()
        {
            Assert.AreEqual(null, CreateSut2(_result, _flowIn).FlowOut);
            Assert.AreSame(_flowOut, CreateSut3(_result, _flowIn, _flowOut).FlowOut);
        }
    }
}